package rn.automacao.banco;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Conexao {

	private static Conexao singleton = new Conexao();

	private String driver = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=ProducaoOS";

	private String usuer = "sa";

	private String senha = "01ntl103";

	public static Conexao getInstance() {
		return singleton;
	}

	private Conexao() {
		iniciaPropriedades();
	}

	private void iniciaPropriedades() {

		try {
			Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");

		} catch (ClassNotFoundException ex) {
			ex.printStackTrace();
		}
	}

	public Connection abreConexao() {
		try {
			Connection conn = DriverManager.getConnection(driver, usuer, senha);
			return conn;
		} catch (SQLException ex) {
			ex.printStackTrace();
		}
		return null;
	}
}
